/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tpgen.patterns;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import tpgen.grammar.Variable;

/**
 *
 * @author shanki
 */
public class Axioms implements Iterable<Axiom> {
    private List<Axiom> axioms  = new ArrayList<Axiom>();
    
    public Set<Variable> getVariables() {
        Set<Variable> variables = new HashSet<Variable>();
        
        for (Axiom axiom : axioms) {
            variables.addAll(axiom.getVariables());
        }
        
        return variables;
    }

    @Override
    public Iterator<Axiom> iterator() {
        return axioms.iterator();
    }

    public void add(Axiom axiom) {
        axioms.add(axiom);
    }
    
    public Axiom get(int index) {
        return axioms.get(index);
    }    

    public int size() {
        return axioms.size();
    }
}
